export default (options: any) => {
  return {
    searchFileds: [
      {
        span: 5,
        field: 'deptId',
        placeholder: '请输入所属科室',
        label: '所属科室',
        tag: 'a-tree-select',
        initValue: '',
        attrs: {
          'data': options.deptTree,
          'treeProps': {
            virtualListProps: {
              height: 200,
            },
          },
          'field-names': {
            key: 'id',
            title: 'label',
          },
          'allow-search': true,
          'allow-clear': true,
          'filter-tree-node': (
            searchValue: string,
            nodeData: { label: string }
          ) => {
            return (
              String(nodeData.label)
                .toLowerCase()
                .indexOf(String(searchValue).toLowerCase()) > -1
            );
          },
        },
      },
      {
        span: 5,
        field: 'nickName',
        placeholder: '请输入患者姓名',
        label: '患者姓名',
        tag: 'a-input',
        initValue: '',
      },
      {
        span: 5,
        field: 'idNumber',
        placeholder: '请输入身份证号',
        label: '身份证号',
        tag: 'a-input',
        initValue: '',
      },
      {
        span: 5,
        field: 'sex',
        placeholder: '请选择性别',
        label: '性别',
        initValue: '',
        tag: 'a-select',
        attrs: {
          options: options.sys_user_sex,
        },
      },
    ],
    tableColumns: [
      {
        dataIndex: 'userId',
        title: '序号',
        width: 150,
      },
      {
        dataIndex: 'nickName',
        title: ' 患者姓名',
        width: 150,
      },
      {
        dataIndex: 'sex',
        title: '患者性别',
        slotName: 'sex',
        width: 100,
      },
      {
        dataIndex: 'idNumber',
        title: '身份证号',
        width: 200,
      },
      {
        dataIndex: 'deptName',
        title: '所属科室',
      },
      {
        dataIndex: 'patientType',
        title: '病种标签',
        slotName: 'patientType',
      },
      {
        dataIndex: 'age',
        title: '年龄',
      },
      {
        dataIndex: 'emergencyContact',
        title: '紧急联系人',
      },
      {
        dataIndex: 'createTime',
        title: '注册时间',
      },
      {
        dataIndex: 'travelPath',
        title: '行程轨迹',
        slotName: 'travelPath',
      },
      {
        dataIndex: 'optional',
        title: '操作',
        slotName: 'optional',
        width: 220,
      },
    ],
    editFields: [
      // {
      //   key: 'baseInfo',
      //   slot: 'baseInfo',
      // },
      {
        key: 'deptId',
        label: '所属科室',
        tag: 'a-tree-select',
        decorator: {
          rules: [{ required: true, message: '请选择所属科室' }],
        },
        attrs: {
          'placeholder': '请选择所属科室',
          'data': options.deptTree,
          'treeProps': {
            virtualListProps: {
              height: 200,
            },
          },
          'field-names': {
            key: 'id',
            title: 'label',
          },
          'allow-search': true,
          'allow-clear': true,
          'filter-tree-node': (
            searchValue: string,
            nodeData: { label: string }
          ) => {
            return (
              String(nodeData.label)
                .toLowerCase()
                .indexOf(String(searchValue).toLowerCase()) > -1
            );
          },
        },
      },
      {
        key: 'nickName',
        label: '患者姓名',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入患者姓名',
        },
        decorator: {
          rules: [{ required: true, message: '请输入患者姓名' }],
        },
      },
      {
        key: 'phonenumber',
        label: '手机号',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: { placeholder: '请输入手机号' },
        decorator: {
          rules: [
            { required: true, message: '请输入手机号' },
            {
              match: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: '手机号格式不正确',
              trigger: 'blur',
            },
          ],
        },
      },
      {
        key: 'userName',
        label: '患者账号',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入患者账号',
        },
        decorator: {
          rules: [{ required: true, message: '请输入患者账号' }],
        },
      },
      {
        key: 'password',
        label: '密码',
        tag: 'a-input-password',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        show: (data: any) => {
          return !data.userId;
        },
        attrs: {
          placeholder: '请输入密码',
        },
        decorator: {
          rules: [{ required: true, message: '请输入密码' }],
        },
      },
      {
        key: 'dateOfBirth',
        label: '出生日期',
        tag: 'a-date-picker',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          'placeholder': '请选择出生日期',
          'style': {
            width: '230px',
          },
          'value-format': 'YYYY/MM/DD',
        },
        decorator: {
          rules: [{ required: false, message: '请选择出生日期' }],
        },
      },
      {
        key: 'idNumber',
        label: '身份证号',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入身份证号',
        },
        decorator: {
          rules: [
            { required: true, message: '请输入身份证号' },
            {
              match:
                /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
              message: '身份证格式不争取',
              trigger: 'blur',
            },
          ],
        },
      },
      {
        key: 'sex',
        label: '性别',
        tag: 'a-select',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请选择性别',
          options: options.sys_user_sex,
        },
        decorator: {
          rules: [{ required: false, message: '请选择性别' }],
        },
      },
      {
        key: 'userHeight',
        label: '身高',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入身高（单位：M）',
        },
        decorator: {
          rules: [{ required: true, message: '请输入身高（单位：M）' }],
        },
      },
      {
        key: 'userWeight',
        label: '体重',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入体重（单位：KG）',
        },
        decorator: {
          rules: [{ required: true, message: '请输入体重（单位：KG）' }],
        },
      },
      {
        key: 'patientType',
        label: '病种标签',
        tag: 'a-select',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请选择病种标签',
          options: options.disease_label,
        },
        decorator: {
          rules: [{ required: false, message: '请选择病种标签' }],
        },
      },
      {
        key: 'emergencyContact',
        label: '紧急联系人',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入紧急联系人',
        },
        decorator: {
          rules: [{ required: true, message: '请输入紧急联系人' }],
        },
      },
      {
        key: 'emergencyContactPhone',
        label: '紧急联系电话',
        tag: 'a-input',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请输入紧急联系电话',
        },
        decorator: {
          rules: [
            { required: true, message: '请输入紧急联系电话' },
            {
              match: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: '手机号格式不正确',
              trigger: 'blur',
            },
          ],
        },
      },
      {
        key: 'hospitalizationTime',
        label: '住院时间',
        tag: 'a-date-picker',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请选择住院时间',
          style: {
            width: '230px',
          },
          showTime: true,
        },
        decorator: {
          rules: [{ required: false, message: '请选择住院时间' }],
        },
      },
      {
        key: 'leaveHospitalTime',
        label: '出院时间',
        tag: 'a-date-picker',
        span: 12,
        formItemAttrs: {
          'label-col-props': { span: 8 },
          'wrapper-col-props': { span: 16 },
        },
        attrs: {
          placeholder: '请选择出院时间',
          style: {
            width: '230px',
          },
          showTime: true,
        },
        decorator: {
          rules: [{ required: false, message: '请选择出院时间' }],
        },
      },
      {
        key: 'homeAddress',
        label: '家庭住址',
        tag: 'a-input',
        attrs: {
          placeholder: '请输入家庭住址',
        },
        decorator: {
          rules: [{ required: false, message: '请输入家庭住址' }],
        },
      },
      {
        key: 'remark',
        label: '备注',
        tag: 'a-input',
        span: 24,
        formItemAttrs: {
          'label-col-props': { span: 4 },
          'wrapper-col-props': { span: 20 },
        },
        attrs: {
          placeholder: '请输入备注',
        },
        decorator: {
          rules: [{ required: false, message: '请输入备注' }],
        },
      },
    ],
  };
};
